/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.hieu.sms.model;

import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * 
 * @author do_th
 */
@Entity
@Table(name = "teacher")
@NamedQueries({
		@NamedQuery(name = "Teacher.findAll", query = "SELECT t FROM Teacher t"),
		@NamedQuery(name = "Teacher.findById", query = "SELECT t FROM Teacher t WHERE t.id = :id"),
		@NamedQuery(name = "Teacher.findByTeacherId", query = "SELECT t FROM Teacher t WHERE t.teacherId = :teacherId"),
		@NamedQuery(name = "Teacher.findByDepId", query = "SELECT t FROM Teacher t WHERE t.depId = :depId"),
		@NamedQuery(name = "Teacher.findByMajorId", query = "SELECT t FROM Teacher t WHERE t.majorId = :majorId"),
		@NamedQuery(name = "Teacher.findByName", query = "SELECT t FROM Teacher t WHERE t.name = :name"),
		@NamedQuery(name = "Teacher.findByBirhday", query = "SELECT t FROM Teacher t WHERE t.birhday = :birhday"),
		@NamedQuery(name = "Teacher.findByBirthPlace", query = "SELECT t FROM Teacher t WHERE t.birthPlace = :birthPlace"),
		@NamedQuery(name = "Teacher.findByOriginalPlace", query = "SELECT t FROM Teacher t WHERE t.originalPlace = :originalPlace"),
		@NamedQuery(name = "Teacher.findByAddress", query = "SELECT t FROM Teacher t WHERE t.address = :address"),
		@NamedQuery(name = "Teacher.findByEmail", query = "SELECT t FROM Teacher t WHERE t.email = :email"),
		@NamedQuery(name = "Teacher.findByDegree", query = "SELECT t FROM Teacher t WHERE t.degree = :degree"),
		@NamedQuery(name = "Teacher.findByAcademicTitle", query = "SELECT t FROM Teacher t WHERE t.academicTitle = :academicTitle"),
		@NamedQuery(name = "Teacher.findByTeacherType", query = "SELECT t FROM Teacher t WHERE t.teacherType = :teacherType"),
		@NamedQuery(name = "Teacher.findByContractDate", query = "SELECT t FROM Teacher t WHERE t.contractDate = :contractDate"),
		@NamedQuery(name = "Teacher.findByTeachingFactor", query = "SELECT t FROM Teacher t WHERE t.teachingFactor = :teachingFactor"),
		@NamedQuery(name = "Teacher.findBySalaryFactor", query = "SELECT t FROM Teacher t WHERE t.salaryFactor = :salaryFactor"),
		@NamedQuery(name = "Teacher.findByClazzId", query = "SELECT t FROM Teacher t WHERE t.clazzId = :clazzId") })
public class Teacher extends AbstractPersistentEntity {
	private static final long serialVersionUID = 1L;
	@Id
	@Column(name = "id", updatable = false)
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "TeacherSequence")
	@SequenceGenerator(name = "TeacherSequence", sequenceName = "seq_teacher", allocationSize = 1)
	private Long id;
	@Basic(optional = false)
	@Column(name = "teacher_id")
	private String teacherId;
	@Basic(optional = false)
	@Column(name = "dep_id")
	private String depId;
	@Column(name = "major_id")
	private String majorId;
	@Column(name = "name")
	private String name;
	@Column(name = "birhday")
	@Temporal(TemporalType.DATE)
	private Date birhday;
	@Column(name = "birth_place")
	private String birthPlace;
	@Column(name = "original_place")
	private String originalPlace;
	@Column(name = "address")
	private String address;
	@Column(name = "email")
	private String email;
	@Column(name = "degree")
	private String degree;
	@Column(name = "academic_title")
	private String academicTitle;
	@Column(name = "teacher_type")
	private String teacherType;
	@Column(name = "contract_date")
	@Temporal(TemporalType.DATE)
	private Date contractDate;
	@Column(name = "contract_type")
	private String contractType;
	@Column(name = "teaching_factor")
	private Double teachingFactor;
	@Column(name = "salary_factor")
	private Double salaryFactor;
	@Column(name = "clazz_id")
	private String clazzId;

	public Teacher() {
	}

	public Teacher(Long id) {
		this.id = id;
	}

	public Teacher(Long id, String teacherId, String depId) {
		this.id = id;
		this.teacherId = teacherId;
		this.depId = depId;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getTeacherId() {
		return teacherId;
	}

	public void setTeacherId(String teacherId) {
		this.teacherId = teacherId;
	}

	public String getDepId() {
		return depId;
	}

	public void setDepId(String depId) {
		this.depId = depId;
	}

	public String getMajorId() {
		return majorId;
	}

	public void setMajorId(String majorId) {
		this.majorId = majorId;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Date getBirhday() {
		return birhday;
	}

	public void setBirhday(Date birhday) {
		this.birhday = birhday;
	}

	public String getBirthPlace() {
		return birthPlace;
	}

	public void setBirthPlace(String birthPlace) {
		this.birthPlace = birthPlace;
	}

	public String getOriginalPlace() {
		return originalPlace;
	}

	public void setOriginalPlace(String originalPlace) {
		this.originalPlace = originalPlace;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getDegree() {
		return degree;
	}

	public void setDegree(String degree) {
		this.degree = degree;
	}

	public String getAcademicTitle() {
		return academicTitle;
	}

	public void setAcademicTitle(String academicTitle) {
		this.academicTitle = academicTitle;
	}

	public String getTeacherType() {
		return teacherType;
	}

	public void setTeacherType(String teacherType) {
		this.teacherType = teacherType;
	}

	public Date getContractDate() {
		return contractDate;
	}

	public void setContractDate(Date contractDate) {
		this.contractDate = contractDate;
	}
	
	public String getContractType() {
		return contractType;
	}

	public void setContractType(String contractType) {
		this.contractType = contractType;
	}

	public Double getTeachingFactor() {
		return teachingFactor;
	}

	public void setTeachingFactor(Double teachingFactor) {
		this.teachingFactor = teachingFactor;
	}

	public Double getSalaryFactor() {
		return salaryFactor;
	}

	public void setSalaryFactor(Double salaryFactor) {
		this.salaryFactor = salaryFactor;
	}

	public String getClazzId() {
		return clazzId;
	}

	public void setClazzId(String clazzId) {
		this.clazzId = clazzId;
	}

	@Override
	public int hashCode() {
		int hash = 0;
		hash += (id != null ? id.hashCode() : 0);
		return hash;
	}

	@Override
	public boolean equals(Object object) {
		// TODO: Warning - this method won't work in the case the id fields are
		// not set
		if (!(object instanceof Teacher)) {
			return false;
		}
		Teacher other = (Teacher) object;
		if ((this.id == null && other.id != null)
				|| (this.id != null && !this.id.equals(other.id))) {
			return false;
		}
		return true;
	}

	@Override
	public String toString() {
		return "com.hieu.sms.model.Teacher[ id=" + id + " ]";
	}

}
